package teach.aistar.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import teach.aistar.model.entity.*;
import teach.aistar.service.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping("/user")
public class RemindController {

    @Autowired
    private ICarBandsService iCarBandsService;

    @Autowired
    private ICarStyleService iCarStyleService;

    @Autowired
    private IOrderService iOrderService;

    @Autowired
    private IOrderDetailsService iOrderDetailsService;

    @Autowired
    private IInsureService iInsureService;

    @Autowired
    private IUserDetailService iUserDetailService;

    @Autowired
    private IExamineService iExamineService;

    //年审到期提醒
    @GetMapping("/regist")
    public String regist(HttpServletRequest request, HttpSession session) {
        List<Examine> examines=iExamineService.selectAll();
        List<CarBrands> carBrands=iCarBandsService.selectAll();
        List<CarStyle> carStyles=iCarStyleService.findAll();
        List<Orders> orders=iOrderService.selectOrderAll();
        List<UserDetail> userDetails=iUserDetailService.selectDetailAll();

        request.setAttribute("orderList",orders);
        request.setAttribute("carStyleList",carStyles);
        request.setAttribute("carBrandList",carBrands);
        request.setAttribute("examineList",examines);
        request.setAttribute("userDetailList",userDetails);
        return "jsp/backend/page-list-regist";
    }

    //保险到期提醒
    @GetMapping("/insurance")
    public String insur(HttpServletRequest request, HttpSession session) {
        List<Orders> orders=iOrderService.selectOrderAll();
        List<CarBrands> bands = iCarBandsService.selectAll();
        List<CarStyle> styles = iCarStyleService.findAll();
        List<Insure> insures=iInsureService.selectInsureAll();
        List<UserDetail> userDetails=iUserDetailService.selectDetailAll();

        request.setAttribute("orderList",orders);
        request.setAttribute("brandsList", bands);
        request.setAttribute("stylesList",styles);
        request.setAttribute("insuresList",insures);
        request.setAttribute("userDetailList",userDetails);

        return "jsp/backend/page-list-insur";
    }
}
